/*
 * 
 * 
 * 
 */
package com.hboxs.asl.entity;

import org.hibernate.validator.constraints.NotEmpty;

import javax.persistence.*;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * Entity - 退货项
 */
@Entity
@Table(name = "xx_returns_item")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "xx_returns_item_sequence")
public class ReturnsItem extends BaseEntity {

    private static final long serialVersionUID = -4112374596087084162L;

    /**
     * 商品编号
     */
    private String sn;

    /**
     * 商标题称
     */
    private String name;

    /**
     * 数量
     */
    private Integer quantity;

    /**
     * 退货单
     */
    private Returns returns;

    /**
     * 获取商品编号
     *
     * @return 商品编号
     */
    @NotEmpty
    @Column(nullable = false, updatable = false)
    public String getSn() {
        return sn;
    }

    /**
     * 设置商品编号
     *
     * @param sn 商品编号
     */
    public void setSn(String sn) {
        this.sn = sn;
    }

    /**
     * 获取商标题称
     *
     * @return 商标题称
     */
    @NotEmpty
    @Column(nullable = false, updatable = false)
    public String getName() {
        return name;
    }

    /**
     * 设置商标题称
     *
     * @param name 商标题称
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取数量
     *
     * @return 数量
     */
    @NotNull
    @Min(1)
    @Column(nullable = false, updatable = false)
    public Integer getQuantity() {
        return quantity;
    }

    /**
     * 设置数量
     *
     * @param quantity 数量
     */
    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    /**
     * 获取退货单
     *
     * @return 退货单
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(nullable = false, updatable = false)
    public Returns getReturns() {
        return returns;
    }

    /**
     * 设置退货单
     *
     * @param returns 退货单
     */
    public void setReturns(Returns returns) {
        this.returns = returns;
    }

}